package com.tucy.logistics.modules.goods.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tucy.logistics.common.dto.goods.GoodsTypeTransportDto;
import com.tucy.logistics.common.entity.goods.GoodsTypeTransport;
import com.tucy.logistics.common.result.Result;
import com.tucy.logistics.modules.goods.service.GoodsTypeTransportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * author: tcy
 * createDate: 2023/10/12
 * description:
 */
@Api(tags = "货物类型")
@RestController
@RequestMapping("/goodsTypeTransport")
public class GoodsTypeTransportController {

    @Autowired
    GoodsTypeTransportService goodsTypeTransportService;

    @ApiOperation(value = "查询货品运输")
    @PostMapping("/queryAll")
    public Result<Page<GoodsTypeTransport>> queryAll(@RequestBody GoodsTypeTransportDto goodsTypeTransportDto) {
        return Result.success(goodsTypeTransportService.queryAll(goodsTypeTransportDto));
    }

    @ApiOperation(value = "增改货品运输")
    @PostMapping("/saveUpdateGoods")
    public Result<Boolean> saveUpdateGoods(@RequestBody GoodsTypeTransport goodsTypeTransport) {
        return Result.success(goodsTypeTransportService.saveUpdateGoods(goodsTypeTransport));
    }

    @ApiOperation(value = "删除货品运输")
    @GetMapping("/deleteGoodsTransport/{id}")
    public Result<Boolean> deleteGoodsTransport(@PathVariable("id") String id) {
        return Result.success(goodsTypeTransportService.deleteGoodsTransport(id));
    }

    @ApiOperation(value = "货品运输详情")
    @GetMapping("/detailsGoodsTransport/{id}")
    public Result<GoodsTypeTransport> detailsGoodsTransport(@PathVariable("id") String id) {
        return Result.success(goodsTypeTransportService.detailsGoodsTransport(id));
    }
}
